<template>
  <div :class="'i-editor-input'">
    <div :class="'i-editor-textarea-top'" :style="editorTopStyle">
      <i-editor-textarea v-model="description"
                                       ref="editorTextareaRef"
                                       @style-change="styleChangeTextarea"/>
    </div>
  </div>
</template>

<script>
import IEditorTextarea from './IEditorTextarea'

export default {
  name: 'IEditor',
  components: {
    IEditorTextarea
  },
  props: [
  ],
  computed: {
  },
  data () {
    return {
      description: '',
      editorTopStyle: '',
    }
  },
  watch: {
    value (value) {
      value = value || {}
      this.description = value.description
    },
    description (value) {
    },
  },
  methods: {
    styleChangeTextarea (value) {
      this.editorTopStyle = value
    },
    // 清空内容
    clearData () {
      this.description = []
    },
  },
  created () {

  }
}
</script>

<style lang="less" scoped>
.media-uploader-small {
  width: 340px;
  height: 185px;
  margin-left: -10px;
}

.is-error .i-editor-textarea-top {
  border-color: #f56c6c !important;
}

.is-error .i-editor-textarea-top-simple {
  border-color: #f56c6c !important;
}

.i-editor-textarea-top-simple {
  border-radius: 3px;
  border: 1px solid #dcdfe6;
}

.i-editor-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 33px;
}

.i-editor-textarea-top {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr max-content;
  border: 1px solid;
  border-radius: 3px;
}

.lesson-material-attachment-item {
  display: flex;
  background-color: #f2f2f2;
  color: #606266;
  align-items: center;
  width: 452px;
  min-height: 35px;
  border-radius: 5px;
  margin-bottom: 5px;
  cursor: initial;
}

.lesson-material-attachment-item-img {
  width: 20px;
  margin-left: 5px;
  margin-right: 5px;
  height: 25px;
}

/deep/ .el-divider {
  height: 1px;
  width: auto;
  margin: 0;
}

/deep/ .lesson-material-attachment-item .lg-icon-close {
  margin-left: auto;
  margin-right: 10px;
  top: 11px;
  cursor: pointer;
}

.media-uploader-small {
  width: 340px;
  height: 185px;
  margin-left: -10px;
}
</style>
